<div class="breadcrumb">
    <a href="#">全部分类</a>
    <span>></span>
    <a href="#">新鲜水果</a>
</div>
<script>
    $(function () {
        let sort = {{.sort}};

        if (sort === "") {
            $("#default").addClass("active");
        } else {
            let $id = "#sort_" + sort;
            $($id).addClass("active");
        }



    })
</script>

<div class="main_wrap clearfix">
    <div class="l_wrap fl clearfix">
        <div class="new_goods">
            <h3>新品推荐</h3>
            <ul>
                {{range .goodsNew}}
                    <li>
                        <a href="/goodsDetail?id={{.Id}}"><img src="{{.Image}}"></a>
                        <h4><a href="#">{{.Name}}</a></h4>
                        <div class="prize">￥{{.Price}}</div>
                    </li>
                {{end}}
            </ul>
        </div>
    </div>

    <div class="r_wrap fr clearfix">
        <div class="sort_bar">
            <a href="/goodsList?type_id={{.type_id}}" id="default">默认</a>
            <a href="/goodsList?type_id={{.type_id}}&sort=price" id="sort_price">价格</a>
            <a href="/goodsList?type_id={{.type_id}}&sort=sale" id="sort_sale">人气</a>
        </div>

        <ul class="goods_type_list clearfix">
            {{range .goods}}
                <li>
                    <a href="/goodsDetail?id={{.Id}}"><img src="{{.Image}}"></a>
                    <h4><a href="detail.html">{{.Name}}</a></h4>
                    <div class="operate">
                        <span class="prize">￥{{.Price}}</span>
                        <span class="unit">{{.Unite}}</span>
                        <a href="/goodsDetail?id={{.Id}}" class="add_goods" title="加入购物车"></a>
                    </div>
                </li>
            {{end}}
        </ul>

        <div class="pagenation">
            <a href="/goodsList?type_id={{$.type_id}}&page={{ShowPrePage .pageIndex}}&sort={{.sort}}">上一页</a>
            {{range .pages}}
                {{if eq $.pageIndex .}}
                    <a href="/goodsList?type_id={{$.type_id}}&page={{.}}&sort={{$.sort}}" class="active">{{.}}</a>
                {{else}}
                    <a href="/goodsList?type_id={{$.type_id}}&page={{.}}&sort={{$.sort}}">{{.}}</a>
                {{end}}
            {{end}}
            <a href="/goodsList?type_id={{$.type_id}}&page={{ShowNextPage .pageIndex .pageCount}}&sort={{.sort}}">下一页></a>
        </div>
    </div>
</div>

